package com.flitsneak.designpatterns.behavioralpatterns.observer;

import java.util.ArrayList;

/**
 * @author flitsneak
 * @email flitsneak@gmail.com
 * @date 2022/7/19 16:24
 * @description
 */
public class MissDuan implements Observable, SensitiveActivity {

    private ArrayList<Observer> observers = new ArrayList<>(8);

    @Override
    public void addObserver(Observer observer) {
        this.observers.add(observer);
    }

    @Override
    public void deleteObserver(Observer observer) {
        this.observers.remove(observer);
    }

    @Override
    public void notifyObservers(String info) {
        observers.forEach(o -> o.update(info));
    }

    @Override
    public void makeDate() {
        this.notifyObservers("段小姐准备和男生约会");
    }

    @Override
    public void talkWithBoy() {
        this.notifyObservers("段小姐和男生聊得很开心");
    }
}
